--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
--[[

    技能指示物品。

]]--
--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
local assets =
{
    -- Asset("ANIM", "anim/cane.zip"),
    -- Asset("ANIM", "anim/swap_cane.zip"),
}

local function spell_com_install(inst)
    inst:ListenForEvent("Loramia_OnEntityReplicated.loramia_com_item_spell",function(inst,replica_com)
        replica_com:Set_Dotted_Circle_Radius(10)
        replica_com:Set_Mouse_Left_Click_Fn(function(inst,owner,pt,target)
                        --- 往物品自身发送event
                        replica_com:PushEvent("left_clicked",{pt = pt})
        end)
        replica_com:Set_Mouse_Right_Click_Fn(function(inst,owner,pt,target)
                        --- 往物品自身发送event
                        replica_com:PushEvent("right_clicked",{pt = pt})


        end)
        replica_com.indicator_type = "arrow" -- "circle" or "arrow"
    end)
    if not TheWorld.ismastersim then
        return
    end
    inst:AddComponent("loramia_com_item_spell")
    inst.components.loramia_com_item_spell:SetNeed2CloseController(false)
    -----------------------------------------------------------------------------
    ---
        inst:ListenForEvent("left_clicked",function(inst,_table)
            print("left_clicked +++++++++++++++ ",_table.pt.x,_table.pt.y,_table.pt.z)
            inst:Remove()
        end)
        inst:ListenForEvent("right_clicked",function(inst,_table)
            inst:Remove()
            print("取消技能")
        end)
    -----------------------------------------------------------------------------
end

local function fn()
    local inst = CreateEntity()
    inst.entity:AddTransform()
    inst.entity:AddAnimState()
    inst.entity:AddSoundEmitter()
    inst.entity:AddNetwork()
    inst.entity:SetPristine()
    spell_com_install(inst)
    return inst
end

return Prefab("loramia_spell_excample_mouse_radius", fn, assets)
